package by.grsu.coctails.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import by.grsu.coctails.R;
import by.grsu.coctails.common.utils.ImageManager;
import by.grsu.coctails.model.Ingredient;

public class IngredientAdapter extends AbstractAdapter<Ingredient> {

	public IngredientAdapter(Context c, int pItemResource,
			List<Ingredient> pList) {
		super(c, pItemResource, pList);
	}

	@Override
	public void init(View convertView, Ingredient item) {
		if (item != null) {
			TextView name = (TextView) convertView.findViewById(R.id.name);
			name.setText(item.getName());

			ImageView image = (ImageView) convertView.findViewById(R.id.image);
			getImageLoader().bind(this, image,
					ImageManager.HTTP + item.getImage());
		}

	}

}
